import fs from 'fs'
import path from 'path'

const modules = {}

const moduleFiles = fs.readdirSync(path.join(__dirname, './store/modules'))
moduleFiles.forEach(file => {
    const moduleName = file.replace(/\.js$/, '')
    const modulePath = `./store/modules/${file}`
    import(modulePath).then(module => {
        modules[moduleName] = module.default || module
    })
})

export default modules
